package com.example.demo4.controller;


import com.example.demo4.domain.Teacher;
import com.example.demo4.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class TeacherController {
    @Autowired
    TeacherService teacherService;
    @RequestMapping("/teacher/list")
    public String list(Model model) {
        List<Teacher> teachers =teacherService.findAll();
        System.out.println(teachers);
        model.addAttribute("data",teachers);

        return "teacher/list";
    }
}
